import request from '@/utils/request'

// 创建ERP 打款申请
export function createPurPurchaseOrder(data) {
  return request({
    url: '/erp/pur-purchase-order/create',
    method: 'post',
    data: data
  })
}

// 更新ERP 打款申请
export function updatePurPurchaseOrder(data) {
  return request({
    url: '/erp/pur-purchase-order/update',
    method: 'put',
    data: data
  })
}

export function updateCountPurPurchaseOrder(data) {
  return request({
    url: '/erp/pur-purchase-order/updateCount',
    method: 'put',
    data: data
  })
}

// 删除ERP 打款申请
export function deletePurPurchaseOrder(id) {
  return request({
    url: '/erp/pur-purchase-order/delete?id=' + id,
    method: 'delete'
  })
}

// 获得ERP 打款申请
export function getPurPurchaseOrder(id) {
  return request({
    url: '/erp/pur-purchase-order/get?id=' + id,
    method: 'get'
  })
}

// 获得ERP 打款申请分页
export function getPurPurchaseOrderPage(params) {
  return request({
    url: '/erp/pur-purchase-order/page',
    method: 'get',
    params
  })
}
// 导出ERP 打款申请 Excel
export function exportPurPurchaseOrderExcel(params) {
  return request({
    url: '/erp/pur-purchase-order/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// ==================== 子表（ERP 采购单项） ====================
      // 获得ERP 采购单项列表
    export function getPurPurchaseOrderItemListByPurchaseOrderId(purchaseOrderId) {
      return request({
        url: '/erp/pur-purchase-order/pur-purchase-order-item/list-by-purchase-order-id?purchaseOrderId=' + purchaseOrderId,
        method: 'get'
      })
    }
  